/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * WebPanel.java
 *
 * Created on May 8, 2011, 8:17:43 PM
 */

package com.chazaqdev.etei;

import chrriis.dj.nativeswing.swtimpl.components.DefaultWebBrowserDecorator;
import chrriis.dj.nativeswing.swtimpl.components.JWebBrowser;
import chrriis.dj.nativeswing.swtimpl.components.WebBrowserDecorator;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import javax.swing.BorderFactory;
import javax.swing.JCheckBox;
import javax.swing.JPanel;

/**
 *
 * @author mike
 */
public class WebPanel extends javax.swing.JPanel {

    JWebBrowser jwb;

    /** Creates new form WebPanel */
    public WebPanel() {
//        super(new BorderLayout());
        setLayout(new java.awt.GridLayout());
//        JWebBrowser.setWebBrowserDecoratorFactory(new JWebBrowser.WebBrowserDecoratorFactory() {
//            public WebBrowserDecorator createWebBrowserDecorator(JWebBrowser jwb, Component cmpnt) {
//                return createCustomWebBrowserDecorator(jwb, cmpnt);
//            }
//        });

        jwb = new JWebBrowser();
        jwb.setBarsVisible(false);
        jwb.setButtonBarVisible(false);
        jwb.setMenuBarVisible(false);
        jwb.setStatusBarVisible(true);
        
        jwb.navigate("localhost:" + Main.getJettyServerHandler().getPort() );
        
        add(jwb);

    }

    private static WebBrowserDecorator createCustomWebBrowserDecorator(JWebBrowser webBrowser, Component renderingComponent) {
        return new DefaultWebBrowserDecorator(webBrowser, renderingComponent) {

            @Override
            protected void addMenuBarComponents(WebBrowserMenuBar menuBar) {
              //None, thank you
            }

            @Override
            protected void addButtonBarComponents(WebBrowserButtonBar buttonBar) {
                //None, thank you
            }
        };
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setLayout(new java.awt.GridLayout());
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables

}
